package com.Service;

import com.dao.DepartmentMapper;
import com.entity.Department;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DepartmentService {
    @Autowired
    private DepartmentMapper departmentMapper;

    /**
     * 查询
     * @param department
     * @return
     */
    public List<Department> queryDepartment(Department department){
        return departmentMapper.selectAll();
    }

    /**
     * 新增
     * @param department
     * @return
     */
    public int addDepartment(Department department){
        return departmentMapper.insert(department);
    }

    /**
     * 删除
     * @param id
     * @return
     */
    public int delDepartment(int id){
        return departmentMapper.deleteByPrimaryKey(id);
    }

    /**
     * 修改
     * @param department
     * @return
     */
    public int updateDepartment(Department department){
        return departmentMapper.updateByPrimaryKey(department);
    }
}
